home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 June: Reference Library / Dev.CD Jun 96 RL / Dev.CD Jun 96 RL.toast / Technical Documentation / develop / develop Issue 24 / develop Issue 24 code / Scriptable Database 1.0a15 / Foundation / AbstractSearchSpec.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-19  |  4.5 KB  |  145 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        AbstractSearchSpec.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Andy Nicholas, Greg Anderson, Tom Conrad, Chris Bingham, Georgiann Puckett, John Thompson-Rohrlich
  7.  
  8.     Copyright:    © 1994-1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.         <10>     9/18/95    ga        
  11.  
  12. */
  13.  
  14. #ifndef AbstractSearchSpec_h
  15. #define AbstractSearchSpec_h
  16.  
  17. //
  18. // MoreAEM.h is needed because methods defined in this
  19. // file take TDescriptors as pass-by-value parameters,
  20. // which requires the complete definition of the class
  21. // TDescriptor.
  22. // 
  23. #include "MoreAEM.h"
  24.  
  25. //
  26. // Object.h is needed because TObject is the base class of
  27. // TAbstractSearchSpec, and for the DeclareSmallClassData macros.
  28. //
  29. #include "Object.h"
  30.  
  31. //
  32. // For 'cObject'
  33. //
  34. #include <AERegistry.h>
  35.  
  36. //
  37. // An object of class TAbstractScriptableObject is passed to TAbstractSearchSpec::Compare
  38. // to determine if the object is within the search set.
  39. //
  40. class TAbstractScriptableObject;
  41. template <class T> class AListOf;
  42.  
  43. //
  44. // Each specific search specification must be able to create a
  45. // search engine to search over the search space that the specification
  46. // covers.
  47. //
  48. class TAbstractSearchEngine;
  49. class TSearchEngineList;
  50. class TAETransaction;
  51.  
  52. class TAbstractCollector;
  53. class TComparisonOperand;
  54.  
  55. //========================================================================================
  56. //
  57. //    CLASS TAbstractSearchSpec
  58. //
  59. // An object derived from TAbstractSearchSpec specifies some
  60. // criterion for searching some specific namespace.
  61. //
  62. //========================================================================================
  63.  
  64. class TAbstractSearchSpec : public TObject
  65.     {
  66.     //
  67.     // --- Methods -------------------------------------------------------------------------------------
  68.     //
  69. public:
  70.     DeclareSmallClassData(TAbstractSearchSpec, TObject);
  71.  
  72.                                         TAbstractSearchSpec() {};
  73.     
  74.     // Methods relating to the use of the search specification
  75.     
  76.     virtual void                        AccessBySearchSpec(const TAETransaction& t, TAbstractCollector* collector, DescType desiredClass, TAbstractScriptableObject* objectToSearch);
  77.     virtual Boolean                        Compare(const TAETransaction& t, TAbstractScriptableObject* itemToTest) = 0;
  78.     
  79.     // Methods relating to the contents of this search specification
  80.     
  81.     virtual DescType                    SpecificationOperator();
  82.     virtual long                        NumberOfSubterms();
  83.     virtual TAbstractSearchSpec*        SpecificationForTerm(long term);    
  84.     virtual TDescriptor                    BuildWhoseTest();        
  85.     TDescriptor                            BuildObjectSpecifier(DescType desiredClass, TDescriptor rootOfSearch);
  86.  
  87.     // Only used by comparison specifications
  88.     
  89.     virtual TComparisonOperand*            GetRightHandComparisonOperand();
  90.     virtual TComparisonOperand*            GetLeftHandComparisonOperand();
  91.  
  92.     // Used to build up specifications from scratch
  93.     
  94.     virtual TAbstractSearchSpec*        AddTermToSpecification(TAbstractSearchSpec* newSpecification);
  95.         
  96.     // Methods relating to the actual search
  97.  
  98.     virtual TAbstractSearchEngine*        CreateSearchEngine();
  99.     virtual void                        CreateSearchEngines(TSearchEngineList* searchEngines, TAbstractScriptableObject* requestor);
  100.     virtual Boolean                        ShouldSearch (TAbstractScriptableObject* searchDisk);
  101.     };
  102.  
  103.  
  104.  
  105. //========================================================================================
  106. //
  107. //    CLASS TLogicalSearchSpec
  108. //
  109. // A logical search specification contains a list of abstract search
  110. // specifications, and either ANDs or ORs them together.
  111. //
  112. //========================================================================================
  113.  
  114. class TLogicalSearchSpec : public TAbstractSearchSpec
  115.     {
  116. protected:
  117.     AListOf<TAbstractSearchSpec*>*        fListOfLogicalTerms;
  118.     DescType                            fLogicalOperator;
  119.     
  120. public:
  121.     DeclareSmallClassData(TLogicalSearchSpec, TAbstractSearchSpec);
  122.  
  123.                                         TLogicalSearchSpec() : fListOfLogicalTerms(nil), fLogicalOperator(typeNull) {};
  124.                                         TLogicalSearchSpec(DescType logicalOperator, AListOf<TAbstractSearchSpec*>* list) : fListOfLogicalTerms(list), fLogicalOperator(logicalOperator) {};
  125.     virtual                                ~TLogicalSearchSpec();
  126.         
  127.     // Methods relating to the contents of this search specification
  128.     
  129.     virtual DescType                    SpecificationOperator();
  130.     virtual long                        NumberOfSubterms();
  131.     virtual TAbstractSearchSpec*        SpecificationForTerm(long term);
  132.     
  133.     // Methods relating to the use of the search specification
  134.     
  135.     virtual Boolean                        Compare(const TAETransaction& t, TAbstractScriptableObject* itemToTest);
  136.  
  137.     // Methods relating to creating object specifiers for this search specification
  138.     
  139.     virtual TDescriptor                    BuildWhoseTest();        
  140.     virtual TAbstractSearchSpec*        AddTermToSpecification(TAbstractSearchSpec* newSpecification);
  141.     
  142.     };
  143.  
  144. #endif
  145.